﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<List<com.IronOne.BoardAppWeb.Models.Paper.AgendaModel>>" %>
<%@ Import Namespace="com.IronOne.BoardAppWeb.Models.Paper" %>

<%  List<AgendaModel> agItems = ((List<AgendaModel>)ViewData["AgendaItemsFull"]).ToList();
   	//List<com.IronOne.BoardAppWeb.Models.Paper.AgendaModel> rootAgItems = agItems.Where(ag => ag.PreviousID == null).ToList();
    
	int x= 0;
    int y = 0;
    int count = 0;
    bool agendaSequencingEnable = Convert.ToBoolean(ConfigurationManager.AppSettings["AgendaSequencingEnable"]);

	foreach (var item in Model)
	   {
           x++; count++;
																						   
		   List<AgendaModel> children = agItems.Where(all => all.PreviousID == item.ID && item.Headorpaper == 0).ToList();
	       string dfdf =  item.DocType.ToString();
         %>
				<li class="myList" id="<%: item.ID %>" value="<%:item.Headorpaper %>" data-paperstatus="<%:item.PaperStatus %>" data-level-position="<%:x %>" >      
					 	<div class="apend">
                            <div class="node"> 
                            <%
                            if (item.Headorpaper == 1)
                            {
                              if(item.DocType == 1)
                              { %>
                                <%--<img src="../.././././../Content/Images/info-icon.png" alt="info icon"/>--%>
                                <img src="<%= Url.Content("~/ContentDownloadApp/Images/info-icon.png")%>" alt="info icon"/>
                             <%}
                              else if (item.DocType == 2)
                              {%>
                                  <%--<img src="../.././././../Content/Images/d-icon.png" alt="discussion icon"/>--%>
                                  <img src="<%= Url.Content("~/ContentDownloadApp/Images/d-icon.png")%>" alt="discussion icon"/>
                            <%}
                              else
                              {%>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <%} %>
	                      <%}%>
                           <%: item.Name %>
                            <%
                                if (item.Headorpaper == 1)
                                {
                                   %>
                                   <p >(<%:item.PaperRefNo%>)</p>
                                   <%
                                } %>
                            </div>
                        </div>				
					<% 
					if (children.Count() > 0)
					{%>
						<ul id="<%: item.ID %>" data-noofchildren=<%:children.Count() %>><% Html.RenderPartial("~/Views/Shared/EditorTemplates/ViewAgenda.ascx", children as List<AgendaModel>); %></ul>
				 <% }  %>
				</li>
	 <%} %>